<?php

include($modRootPath.'lib/mailForm.o.inc.php');
include($modRootPath.'lib/dbaRequestmailer.o.inc.php');

if (!$usr->checkPermission($env->getParam('instance').'_mod_requestmailer_preview','v'))
{
	print "<b>Sie haben nicht die entsprechenden Rechte, um diese Einstellung zu sehen!</b>";
	exit;
}

print '<a href="'.$scriptname.'showForm.php">neu</a><br /><br />';

$mf = new mailForm(new dbaRequestmailer($udba),$instance);

    if ($mf->checkForm())
    {
        $mf->sendMails();
        $mf->showFinScreen();
    }
    else
    {
        ?>
        <form action="<?=$formaction?>" method="post">
            <input type="hidden" name="action" value="send">
            <input type="hidden" name="instance" value="<?=$instance?>">
            <input type="hidden" name="module" value="<?=$module?>">
            <input type="hidden" name="target" value="<?=$env->getParam('target')?>">
        <?php
            if ($env->getParam('action')=='send')
            {
                $mf->showErrorMsg();
                $mf->processForm('');
            }
            else
                $mf->processForm('initial');
        ?>
            <input type="submit" value="Senden">
        </form>
        <?php
    }
    ?>
